package com.zh.autoconfigure;

import com.zh.config.MybatisPlusConfig;
import com.zh.config.RedisConfig;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.web.client.RestTemplate;


// 标记配置类
@Configuration
@Import({MybatisPlusConfig.class, RedisConfig.class})
// 导入配置
public class FccarBasicAutoConfiguration {


    @Bean
    //加一个条件 :当不出存在这个Bean的时候再创建，防止重复创建
    @ConditionalOnMissingBean(RestTemplate.class)
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
}
